def is_prime(num):
    if num < 2:
        return False
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            return False
    return True


def top_primes(lst, n=3):
    return [x for x in lst if is_prime(x)][:n]

if __name__ == '__main__':
    result = top_primes([4, 5, 6, 7, 8, 9, 10, 2, 3], n=4)  # 调用函数，n=4表示我们想要获取前4个质数
    print(result)